package cn.tedu.oa.attendance.starup;

import cn.tedu.oa.attendance.base.config.DingDingConfiguration;
import cn.tedu.oa.attendance.pojo.po.AttendancePO;
import cn.tedu.oa.attendance.service.AttendanceService;
import com.dingtalk.api.response.OapiGettokenResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class DingDingInit implements ApplicationRunner {

    @Autowired
    DingDingConfiguration dingDingConfiguration;
    @Autowired
    AttendanceService attendanceService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
//        1.获取钉钉token
        OapiGettokenResponse accessToken = dingDingConfiguration.getAccessToken();
//        2.订阅Stream模式推送
        dingDingConfiguration.subscribeEvent();



    }


}
